//app.js
App({
  onLaunch: function () {
    if (!wx.getStorageSync('userType')){
      wx.setStorageSync('userType', 2)
    }
    let that=this
    wx.getSystemInfo({
      success(res){
        that.globalData.navHeight=res.statusBarHeight
      }
    })
    var token = wx.getStorageSync('token')
    if (token){
      var _this = this
      wx.request({
        url: this.globalData.baseUrl + 'checkTokenExpire',
        data: {
          token: token
        },
        success: function (res) {
          if (res.data.code == 1000){
            _this.globalData.token = token
          }else{
            wx.removeStorageSync('token')
          }
        }
      })
    }
  },
  wxGetRequest(url, data, callback, errFun){
    wx.request({
      url: url,
      data: data,
      success: function (res) {
        callback(res.data);
      },
      fail: function (err) {
        errFun(res);
      }
    })
  },
  wxPostRequest(url, data, callback, errFun) {
    wx.request({
      url: url,
      data: data,
      method: 'POST',
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        callback(res.data);
      },
      fail: function (err) {
        errFun(res);
      }
    })
  },

  globalData: {
    navHeight:'',
     // baseUrl:'http://bestu.kekezu.net/api/',//上个参数的填写样例，替换成您的域名
     baseUrl:'https://bywc.etjbooks.com.cn/api/',//上个参数的填写样例，替换成您的域名
     baseNew:'https://culture.etjbooks.com.cn/',
    token: '',
    dict:{
      CURRENT_STAGE: [
        {itemText:'已有产品迭代升级',itemValue:1},
        {itemText:'有明确定义的产品设计',itemValue:2},
        {itemText:'概念模糊，需要协助策划',itemValue:3},
      ],
    }
  }
})
